package cn.wildfirechat.app.webhook.github.pojo;

import com.google.gson.Gson;

public class PushEvent {
    public String ref;
    public String before;
    public String after;
    public boolean created;
    public boolean deleted;
    public boolean forced;
    public String base_ref;
    public String compare;
    public Commit[] commits;
    public Commit head_commit;
    public Repository repository;
    public Pusher pusher;
    public Sender sender;

    public static PushEvent fromJson(String jsonStr) {
        return new Gson().fromJson(jsonStr, PushEvent.class);
    }

    public static void main(String[] args) {
        String event1 = "{\"ref\":\"refs/heads/master\",\"before\":\"0000000000000000000000000000000000000000\",\"after\":\"d7c02e15ef0f3eca28400bc92f2decbd6b9df2e0\",\"repository\":{\"id\":242506330,\"node_id\":\"MDEwOlJlcG9zaXRvcnkyNDI1MDYzMzA=\",\"name\":\"github_webhoot\",\"full_name\":\"wildfirechat/github_webhoot\",\"private\":false,\"owner\":{\"name\":\"wildfirechat\",\"email\":\"heavyrain.lee@wildfirechat.cn\",\"login\":\"wildfirechat\",\"id\":33191460,\"node_id\":\"MDEyOk9yZ2FuaXphdGlvbjMzMTkxNDYw\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/33191460?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/wildfirechat\",\"html_url\":\"https://github.com/wildfirechat\",\"followers_url\":\"https://api.github.com/users/wildfirechat/followers\",\"following_url\":\"https://api.github.com/users/wildfirechat/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/wildfirechat/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/wildfirechat/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/wildfirechat/subscriptions\",\"organizations_url\":\"https://api.github.com/users/wildfirechat/orgs\",\"repos_url\":\"https://api.github.com/users/wildfirechat/repos\",\"events_url\":\"https://api.github.com/users/wildfirechat/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/wildfirechat/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"html_url\":\"https://github.com/wildfirechat/github_webhoot\",\"description\":\"Github webhook robot applaciton\",\"fork\":false,\"url\":\"https://github.com/wildfirechat/github_webhoot\",\"forks_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/forks\",\"keys_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/teams\",\"hooks_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/hooks\",\"issue_events_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/events\",\"assignees_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/tags\",\"blobs_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/languages\",\"stargazers_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/stargazers\",\"contributors_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/contributors\",\"subscribers_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/subscribers\",\"subscription_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/subscription\",\"commits_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/merges\",\"archive_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/downloads\",\"issues_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/wildfirechat/github_webhoot/deployments\",\"created_at\":1582458085,\"updated_at\":\"2020-02-23T11:41:25Z\",\"pushed_at\":1582458469,\"git_url\":\"git://github.com/wildfirechat/github_webhoot.git\",\"ssh_url\":\"git@github.com:wildfirechat/github_webhoot.git\",\"clone_url\":\"https://github.com/wildfirechat/github_webhoot.git\",\"svn_url\":\"https://github.com/wildfirechat/github_webhoot\",\"homepage\":null,\"size\":0,\"stargazers_count\":0,\"watchers_count\":0,\"language\":null,\"has_issues\":true,\"has_projects\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"archived\":false,\"disabled\":false,\"open_issues_count\":0,\"license\":null,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\",\"stargazers\":0,\"master_branch\":\"master\",\"organization\":\"wildfirechat\"},\"pusher\":{\"name\":\"heavyrain2012\",\"email\":\"heavyrain.lee@gmail.com\"},\"organization\":{\"login\":\"wildfirechat\",\"id\":33191460,\"node_id\":\"MDEyOk9yZ2FuaXphdGlvbjMzMTkxNDYw\",\"url\":\"https://api.github.com/orgs/wildfirechat\",\"repos_url\":\"https://api.github.com/orgs/wildfirechat/repos\",\"events_url\":\"https://api.github.com/orgs/wildfirechat/events\",\"hooks_url\":\"https://api.github.com/orgs/wildfirechat/hooks\",\"issues_url\":\"https://api.github.com/orgs/wildfirechat/issues\",\"members_url\":\"https://api.github.com/orgs/wildfirechat/members{/member}\",\"public_members_url\":\"https://api.github.com/orgs/wildfirechat/public_members{/member}\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/33191460?v=4\",\"description\":\"北京野火无限网络科技有限公司--专注于即时通讯技术，提供优质可控的即时通讯能力\"},\"sender\":{\"login\":\"heavyrain2012\",\"id\":34463389,\"node_id\":\"MDQ6VXNlcjM0NDYzMzg5\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/34463389?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/heavyrain2012\",\"html_url\":\"https://github.com/heavyrain2012\",\"followers_url\":\"https://api.github.com/users/heavyrain2012/followers\",\"following_url\":\"https://api.github.com/users/heavyrain2012/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/heavyrain2012/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/heavyrain2012/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/heavyrain2012/subscriptions\",\"organizations_url\":\"https://api.github.com/users/heavyrain2012/orgs\",\"repos_url\":\"https://api.github.com/users/heavyrain2012/repos\",\"events_url\":\"https://api.github.com/users/heavyrain2012/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/heavyrain2012/received_events\",\"type\":\"User\",\"site_admin\":false},\"created\":true,\"deleted\":false,\"forced\":false,\"base_ref\":null,\"compare\":\"https://github.com/wildfirechat/github_webhoot/commit/d7c02e15ef0f\",\"commits\":[{\"id\":\"d7c02e15ef0f3eca28400bc92f2decbd6b9df2e0\",\"tree_id\":\"7311f1117ef41ec7585ae1e8ade79c1dae72ae7f\",\"distinct\":true,\"message\":\"first commit\",\"timestamp\":\"2020-02-23T19:47:09+08:00\",\"url\":\"https://github.com/wildfirechat/github_webhoot/commit/d7c02e15ef0f3eca28400bc92f2decbd6b9df2e0\",\"author\":{\"name\":\"heavyrain2012\",\"email\":\"heavyrain.lee@gmail.com\",\"username\":\"heavyrain2012\"},\"committer\":{\"name\":\"heavyrain2012\",\"email\":\"heavyrain.lee@gmail.com\",\"username\":\"heavyrain2012\"},\"added\":[\".gitignore\",\"LICENSE\",\"README.md\",\"github_webhook.iml\",\"mvnw\",\"mvnw.cmd\",\"pom.xml\",\"src/lib/common-0.21.jar\",\"src/lib/sdk-0.21.jar\",\"src/main/java/cn/wildfirechat/app/Application.java\",\"src/main/java/cn/wildfirechat/app/Controller.java\",\"src/main/java/cn/wildfirechat/app/HttpUtils.java\",\"src/main/java/cn/wildfirechat/app/Record.java\",\"src/main/java/cn/wildfirechat/app/RestResult.java\",\"src/main/java/cn/wildfirechat/app/Service.java\",\"src/main/java/cn/wildfirechat/app/ServiceImpl.java\",\"src/main/java/cn/wildfirechat/app/TulingResponse.java\",\"src/main/java/cn/wildfirechat/app/Utils.java\",\"src/main/java/cn/wildfirechat/app/pojo/License.java\",\"src/main/java/cn/wildfirechat/app/pojo/Owner.java\",\"src/main/java/cn/wildfirechat/app/pojo/Repository.java\",\"src/main/java/cn/wildfirechat/app/pojo/Sender.java\",\"src/main/java/cn/wildfirechat/app/pojo/StarEvent.java\",\"src/main/java/ikidou/reflect/TypeBuilder.java\",\"src/main/java/ikidou/reflect/TypeToken.java\",\"src/main/java/ikidou/reflect/exception/TypeException.java\",\"src/main/java/ikidou/reflect/typeimpl/ParameterizedTypeImpl.java\",\"src/main/java/ikidou/reflect/typeimpl/WildcardTypeImpl.java\",\"src/main/resources/application.properties\",\"src/test/java/cn/wildfirechat/app/ApplicationTests.java\"],\"removed\":[],\"modified\":[]}],\"head_commit\":{\"id\":\"d7c02e15ef0f3eca28400bc92f2decbd6b9df2e0\",\"tree_id\":\"7311f1117ef41ec7585ae1e8ade79c1dae72ae7f\",\"distinct\":true,\"message\":\"first commit\",\"timestamp\":\"2020-02-23T19:47:09+08:00\",\"url\":\"https://github.com/wildfirechat/github_webhoot/commit/d7c02e15ef0f3eca28400bc92f2decbd6b9df2e0\",\"author\":{\"name\":\"heavyrain2012\",\"email\":\"heavyrain.lee@gmail.com\",\"username\":\"heavyrain2012\"},\"committer\":{\"name\":\"heavyrain2012\",\"email\":\"heavyrain.lee@gmail.com\",\"username\":\"heavyrain2012\"},\"added\":[\".gitignore\",\"LICENSE\",\"README.md\",\"github_webhook.iml\",\"mvnw\",\"mvnw.cmd\",\"pom.xml\",\"src/lib/common-0.21.jar\",\"src/lib/sdk-0.21.jar\",\"src/main/java/cn/wildfirechat/app/Application.java\",\"src/main/java/cn/wildfirechat/app/Controller.java\",\"src/main/java/cn/wildfirechat/app/HttpUtils.java\",\"src/main/java/cn/wildfirechat/app/Record.java\",\"src/main/java/cn/wildfirechat/app/RestResult.java\",\"src/main/java/cn/wildfirechat/app/Service.java\",\"src/main/java/cn/wildfirechat/app/ServiceImpl.java\",\"src/main/java/cn/wildfirechat/app/TulingResponse.java\",\"src/main/java/cn/wildfirechat/app/Utils.java\",\"src/main/java/cn/wildfirechat/app/pojo/License.java\",\"src/main/java/cn/wildfirechat/app/pojo/Owner.java\",\"src/main/java/cn/wildfirechat/app/pojo/Repository.java\",\"src/main/java/cn/wildfirechat/app/pojo/Sender.java\",\"src/main/java/cn/wildfirechat/app/pojo/StarEvent.java\",\"src/main/java/ikidou/reflect/TypeBuilder.java\",\"src/main/java/ikidou/reflect/TypeToken.java\",\"src/main/java/ikidou/reflect/exception/TypeException.java\",\"src/main/java/ikidou/reflect/typeimpl/ParameterizedTypeImpl.java\",\"src/main/java/ikidou/reflect/typeimpl/WildcardTypeImpl.java\",\"src/main/resources/application.properties\",\"src/test/java/cn/wildfirechat/app/ApplicationTests.java\"],\"removed\":[],\"modified\":[]}}";
        PushEvent pushEvent = new Gson().fromJson(event1, PushEvent.class);
        System.out.println(pushEvent.compare);
    }
}
